package manayShape_Polymorphism2;

public class Child {
    //这个成员变量表示小孩Child要养宠物

    /*Cat     pet1;
    Dog     pet2;

    void buyCat(Cat c){
        pet1=c;
    }

    void buyDog(Dog c){
        pet2=c;
    }*/



    Animal  pet;//降低耦合度。
    void buyPet(Animal a){
        pet=a;
    }




}












